import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.*;


public class XmlTing
{
public static void main(String[] args)
{
try {
 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            DocumentBuilder parser = dbf.newDocumentBuilder();
            Document doc = parser.parse("http://where.yahooapis.com/geocode?q=Nardovegen+6,+Trondheim");

            System.out.println(doc.getTextContent());

            NodeList nodes = doc.getElementsByTagName("latitude");
            System.out.println("There are " + nodes.getLength() +
               "  elements.");

//            System.out.println(nodes.item(0).getNodeName());
            System.out.println(nodes.item(0).getTextContent());
//            System.out.println(nodes.item(0).getNodeName());

            nodes = doc.getElementsByTagName("longitude");

            System.out.println(nodes.item(0).getTextContent());

        } catch (Exception ex) {
            System.out.println(ex);
        }
}
}